<template>
  <el-form :model="createImageForm" :rules="rules" label-width="100px" ref="createFormRef" class="dialogimage">
    <el-form-item prop="name" label="图片名称">
      <el-input placeholder="请输入图片名称" v-model="createImageForm.name" />
    </el-form-item>
    <el-form-item prop="url" label="URL地址">
      <el-input placeholder="请输入图片URL地址" v-model="createImageForm.url" />
    </el-form-item>
    <el-form-item prop="layout" label="画幅类型">
      <el-select placeholder="请选择图片的画幅类型" clearable v-model="createImageForm.layout">
        <el-option
                v-for="item in layoutList"
                :key="item.layoutid"
                :value="item.layoutid"
                :label="item.layoutname"
        />
      </el-select>
    </el-form-item>
  </el-form>
</template>

<script>
  import {reactive, ref, toRef} from 'vue'
  import { layoutList} from "@/utils/usage-config";

  export default {
    name: "NetworkImage",
    props: {
      createImageFormData: {
        type: Object
      }
    },
    setup(props) {
      const createImageForm = toRef(props, 'createImageFormData')
      const rules = reactive({
        groupid_list: [{required: true, message: '请选择所属部门', trigger: 'change'}],
        name: [{required: true, message: '请输入图片名称', trigger: 'blur'}],
        url: [{required: true, message: '请输入图片地址', trigger: 'blur'}],
      })
      const createFormRef = ref(null)
      return {
        createImageForm,
        layoutList,
        rules,
        createFormRef,
      }
    }
  }
</script>

<style lang="scss">
.el-tab-pane{
  .dialogimage{
    .el-form-item{
      margin-bottom: 18px;
      display: flex !important;
      width:55% !important;
      .el-select{
        width:100%;
      }
      .el-form-item__content{
        .el-input{
          .el-input__inner{
            height: 36px !important;
            line-height: 36px !important;
          }
        }
      }
    }
  }
}
</style>
